/**
 * @author kristian
 */

var nodeCheck = {
	isPerson: function(node) {
		return (node.name && (node.gender == 'male' || node.gender == 'female'));
	},
	isCompany: function(node) {
		return (node.name && m3gen.utils.isValidObj(node.employees));
	},  
}

var nodeType = {
	person: 'person',
	company: 'company',
	unknown: 'unknown'
}

// return objType as a string identifier
// used to lookup matching ruleSet key in ruleSets (within generatorRuleSet)
var selectObjType_person_company = function(node){
    if (node && node !== '#') {
        if (nodeCheck.isPerson(node)) {		
			return nodeType.person;
		}
		else {			
			return nodeType.unknown;
		}
    } else {
        return null;
    }
};

var selectObjType_person = function(node){
    if (node && node !== '#') {
        if (nodeCheck.isPerson(node)) {		
			return nodeType.person;
		}
		else if (nodeCheck.isCompany(node)) {		
			return nodeType.company;
		} else {			
			return nodeType.unknown;
		}
    } else {
        return null;
    }
};

var selectObjType_company = function(node){
    if (node && node !== '#') {
        if (nodeCheck.isCompany(node)) {		
			return nodeType.person;
		}
		else {			
			return nodeType.unknown;
		}
    } else {
        return null;
    }
};